//
//  UIImageView+AFWebImage.h
//  AFChat
//
//  Created by Void on 2018/6/25.
//  Copyright © 2018年 afei. All rights reserved.
//
// 网络图片拓展，基于SDWebImage

#import <UIKit/UIKit.h>

typedef NS_OPTIONS(NSUInteger, AFWebImageOptions) {
    /**
     * 失败重试（默认）
     */
    AFWebImageRetryFailed = 1 << 0,
};

typedef NS_ENUM(NSInteger,AFImageCacheType) {
    /**
     * 无缓存
     */
    AFImageCacheTypeNone,
    /**
     * 磁盘缓存
     */
    AFImageCacheTypeDisk,
    /**
     * 内存缓存
     */
    AFImageCacheTypeMemory
};
typedef void (^AFWebImageDownloadCompleteBlock)(UIImage *image, NSError *error, AFImageCacheType cacheType, NSURL *imageURL);
typedef void (^AFWebImageDownloaderProgressBlock)(NSInteger receivedSize, NSInteger expectedSize, NSURL *targetURL);

@interface UIImageView (AFWebImage)

- (void)tt_setImageWithURL:(NSURL *)url;
- (void)tt_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder;
- (void)tt_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(AFWebImageOptions)options;
- (void)tt_setImageWithURL:(NSURL *)url completed:(AFWebImageDownloadCompleteBlock)completedBlock;
- (void)tt_setImageWithURL:(NSURL *)url options:(AFWebImageOptions)options completed:(AFWebImageDownloadCompleteBlock)completedBlock;
- (void)tt_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(AFWebImageDownloadCompleteBlock)completedBlock;
- (void)tt_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(AFWebImageOptions)options completed:(AFWebImageDownloadCompleteBlock)completedBlock;
- (void)tt_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(AFWebImageOptions)options progress:(AFWebImageDownloaderProgressBlock)progressBlock completed:(AFWebImageDownloadCompleteBlock)completedBlock;

- (void)tt_cancelCurrentImageLoad;


@end
